import {createRouter, createWebHistory} from "vue-router";

const router = createRouter({
   history: createWebHistory(),
   //映射关系：path -> component
   routes: [
      {
         path: '/',
         redirect: 'home'
      },
      {
         path: '/home',
         component: () => import('@/views/home/Home.vue')
      },
      {
         path: '/favor',
         component: () => import('@/views/favor/Favor.vue')
      },
      {
         path: '/order',
         component: () => import('@/views/order/Order.vue'),
      },
      {
         path: '/message',
         component: () => import('@/views/message/Message.vue'),
         meta: {
            hideTabbar: true
         }
      },
      {
         path: '/city',
         component: () => import('@/views/city/City.vue'),
         //自定义属性对tabbar进行隐藏
         meta: {
            hideTabbar: true
         }
      },
      {
         path: '/search',
         component: () => import('@/views/search/Search.vue'),
         meta: {
            hideTabbar: true
         }
      },
      {
         path: '/detail/:id',
         component: () => import('@/views/detail/Detail.vue'),
         meta: {
            hideTabbar: false
         }
      }
   ]
})

export default router